//
//  SAInventoryListCell.m
//  saasRetail
//
//  Created by 黄志刚 on 2021/6/21.
//

#import "SAInventoryListCell.h"
#import "SAInventoryListModel2.h"
#import "UILabel+NSMutableAttributedString.h"

@interface SAInventoryListCell ()


@property (nonatomic, strong) UILabel *idLab;
@property (nonatomic, strong) UILabel *orderLab;
@property (nonatomic, strong) UILabel *checkNumLab;
@property (nonatomic, strong) UIView *line;


@property (nonatomic, strong) UILabel *checkNameLab;
@property (nonatomic, strong) UILabel *checkDateLab;
@property (nonatomic, strong) UIView *line2;

@property (nonatomic, strong) UILabel *operateNameLab;
@property (nonatomic, strong) UILabel *operateDateLab;
@property (nonatomic, strong) UIView *line3;

@property (nonatomic, strong) UIImageView *statusImageV;

@end

@implementation SAInventoryListCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

-(void)setModel:(SAInventoryListModel2 *)model {
    _model = model;
    self.idLab.text = [NSString stringWithFormat:@"流水号：%@",model.checkFlowNo];
    if (model.checkOrderNo.length == 0) {
        self.orderLab.text = @"";
    }else {
        self.orderLab.text = [NSString stringWithFormat:@"盘点单：%@",model.checkOrderNo];
    }
    self.checkNumLab.text = [NSString stringWithFormat:@"盘点数：%@",model.afterStock];
   
    self.checkNameLab.text = [NSString stringWithFormat:@"盘点人：%@",model.stockCheckEmpName];
    self.checkDateLab.text = [NSString stringWithFormat:@"盘点时间：%@",model.stockCheckTime];
    

    self.operateNameLab.text = @"--";
    self.operateDateLab.text = @"--";
    if ([model.checkStatus isEqualToString:@"1"]) {
        self.statusImageV.image = [UIImage imageNamed:@"statusImage_1"];
        self.operateNameLab.text = [NSString stringWithFormat:@"处理人：%@",model.confirmEmpName];
        self.operateDateLab.text = [NSString stringWithFormat:@"处理时间：%@",model.checkOrderTime];
    }else if ([model.checkStatus isEqualToString:@"2"]) {
        self.statusImageV.image = [UIImage imageNamed:@"statusImage_2"];
    }else {
        self.statusImageV.image = [UIImage imageNamed:@"statusImage_0"];
    }
}

-(void)initUI {
    
    UILabel *idLab = [[UILabel alloc] initWithFrame:SARectMake(25, 10, 140, 20)];
    idLab.textColor = kBlackColor;
    idLab.font = kFont(15);
    idLab.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:idLab];
    self.idLab = idLab;
    
    UILabel *titleLab1 = [[UILabel alloc] initWithFrame:SARectMake(180, 10, 195, 20)];
    titleLab1.textColor = kBlackColor;
    titleLab1.font = kFont(15);
    titleLab1.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:titleLab1];
    self.orderLab = titleLab1;
    
    UILabel *titleLab2 = [[UILabel alloc] initWithFrame:SARectMake(25, 40, 300, 20)];
    titleLab2.textColor = kBlackColor;
    titleLab2.font = kFont(15);
    titleLab2.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:titleLab2];
    self.checkNumLab = titleLab2;

    UILabel *titleLab3 = [[UILabel alloc] initWithFrame:SARectMake(25, 71, 140, 30)];
    titleLab3.textColor = kLightgGrayColor;
    titleLab3.font = kFont(15);
    titleLab3.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:titleLab3];
    self.checkNameLab = titleLab3;

    UILabel *titleLab4 = [[UILabel alloc] initWithFrame:SARectMake(180, 71, 195, 30)];
    titleLab4.textColor = kLightgGrayColor;
    titleLab4.font = kFont(15);
    titleLab4.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:titleLab4];
    self.checkDateLab = titleLab4;

    UILabel *titleLab5 = [[UILabel alloc] initWithFrame:SARectMake(25, 102, 140, 30)];
    titleLab5.textColor = kLightgGrayColor;
    titleLab5.font = kFont(15);
    titleLab5.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:titleLab5];
    self.operateNameLab = titleLab5;
    
    UILabel *titleLab6 = [[UILabel alloc] initWithFrame:SARectMake(180, 102, 195, 30)];
    titleLab6.textColor = kLightgGrayColor;
    titleLab6.font = kFont(15);
    titleLab6.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:titleLab6];
    self.operateDateLab = titleLab6;
    
    [self.contentView addSubview:self.line];
    [self.contentView addSubview:self.line2];
    [self.contentView addSubview:self.line3];
    
    [self.contentView addSubview:self.statusImageV];
}

-(UIView *)line {
    if (!_line) {
        _line = [[UIView alloc] initWithFrame:SARectMake(0, 70, kBaseScreenWidth, 1)];
        _line.backgroundColor = kLineColor;
    }
    return _line;
}

-(UIView *)line2 {
    if (!_line2) {
        _line2 = [[UIView alloc] initWithFrame:SARectMake(0, 101, kBaseScreenWidth, 1)];
        _line2.backgroundColor = kLineColor;
    }
    return _line2;
}

-(UIView *)line3 {
    if (!_line3) {
        _line3 = [[UIView alloc] initWithFrame:SARectMake(0, 132, kBaseScreenWidth, 8)];
        _line3.backgroundColor = kLineColor;
    }
    return _line3;
}

-(UIImageView *)statusImageV {
    if (!_statusImageV) {
        _statusImageV = [[UIImageView alloc] initWithFrame:SARectMake(280, 5, 90, 90)];
        _statusImageV.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _statusImageV;
}


@end
